<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>数据</title>

</head>

<body>

	<div class="all">
        <center>
        	<h2>数据显示</h2>
        </center>
        
        <h1>users表</h1>
        <table border="1" cellpadding="7"  cellspacing="0">
        				<tr >
        					<td>id</td>
        					<td>account</td>
        					<td>password</td>
        					<td>username</td>
        					<td>isonline</td>
        				</tr>
         <%    //获取数据库中的留言信息，并通过循环方式输出留言                                                        
			int id;
         	String account;
         	String password;
         	String username;
         	String isonline;
         	Connection con = null;
    		Statement stmt = null;
    		ResultSet rs = null;
  			  try {
      				Class.forName("com.mysql.jdbc.Driver");
       				con = DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","413222");
      				String SQL = "SELECT * from users";
      				stmt = con.createStatement();
      				rs = stmt.executeQuery(SQL);
      				while (rs.next()) {    
    	  			id = rs.getInt(1);
    	  			account = rs.getString(2);
    	  			password = rs.getString(3);
    	  			username = rs.getString(4);
    	  			isonline = rs.getString(5);
    	 %>
        			
        				<tr>
        					<td><%=id %></td>
        					<td><%=account %></td>
        					<td><%=password %></td>
        					<td><%=username %></td>
        					<td><%=isonline %></td>
        				</tr>
        			
        			
           <%   }
	} catch (Exception e) {
      e.printStackTrace();
    } 
  %>
  </table>
  
  <h1>user_has_db表</h1>
        <table border="1" cellpadding="7"  cellspacing="0">
        				<tr >
        					<td>db_id</td>
        					<td>owner_id</td>
        					<td>dbname</td>
        					<td>lastTime</td>
        					<td>tag</td>
        					<td>db_type</td>
        				</tr>
         <%    //获取数据库中的留言信息，并通过循环方式输出留言                                                        
			int db_id;
         	String owner_id;
         	String dbname;
         	String lastTime;
         	String tag;
         	String db_type;
  			  try {
      				String SQL = "SELECT * from user_has_db";
      				rs = stmt.executeQuery(SQL);
      				while (rs.next()) {    
    	  			db_id = rs.getInt(1);
    	  			owner_id = rs.getString(2);
    	  			dbname = rs.getString(3);
    	  			lastTime = rs.getString(4);
    	  			tag = rs.getString(5);
    	  			db_type = rs.getString(6);
    	 %>
        			
        				<tr>
        					<td><%=db_id %></td>
        					<td><%=owner_id %></td>
        					<td><%=dbname %></td>
        					<td><%=lastTime %></td>
        					<td><%=tag %></td>
        					<td><%=db_type %></td>
        				</tr>
        			
        			
           <%   }
      				
	} catch (Exception e) {
      e.printStackTrace();
    } 
  %>
  </table>
  
  <h1>student表</h1>
        <table border="1" cellpadding="7"  cellspacing="0">
        				<tr >
        					<td>db_id</td>
        					<td>stu_name</td>
        					<td>form_id</td>
        					<td>stu_sex</td>
        					<td>stu_ins</td>
        					<td>stu_class</td>
        					<td>custom1</td>
        					<td>custom2</td>
        					<td>custom3</td>
        					<td>custom4</td>
        					<td>custom5</td>
        				</tr>
         <%    //获取数据库中的留言信息，并通过循环方式输出留言                                                        
			int db_id1;
         	String stu_name;
         	String form_id;
         	String stu_sex;
         	String stu_ins;
         	String stu_class;
         	String custom1;
         	String custom2;
         	String custom3;
         	String custom4;
         	String custom5;
  			  try {
      				String SQL = "SELECT * from student";
      				rs = stmt.executeQuery(SQL);
      				while (rs.next()) {    
    	  			db_id1 = rs.getInt(1);
    	  			stu_name = rs.getString(2);
    	  			form_id = rs.getString(3);
    	  			stu_sex = rs.getString(4);
    	  			stu_ins = rs.getString(5);
    	  			stu_class = rs.getString(6);
    	  			custom1 = rs.getString(7);
    	  			custom2 = rs.getString(8);
    	  			custom3 = rs.getString(9);
    	  			custom4 = rs.getString(10);
    	  			custom5 = rs.getString(11);
    	 %>
        			
        				<tr>
        					<td><%=db_id1 %></td>
        					<td><%=stu_name %></td>
        					<td><%=form_id %></td>
        					<td><%=stu_sex %></td>
        					<td><%=stu_ins %></td>
        					<td><%=stu_class %></td>
        					<td><%=custom1 %></td>
        					<td><%=custom2 %></td>
        					<td><%=custom3 %></td>
        					<td><%=custom4 %></td>
        					<td><%=custom5 %></td>
        				</tr>
        			
        			
           <%   }
      				
	} catch (Exception e) {
      e.printStackTrace();
    } 
  %>
  </table>
  
   <h1>custom_name表</h1>
        <table border="1" cellpadding="7"  cellspacing="0">
        				<tr >
        					<td>db_id</td>
        					<td>custom_num</td>
        					<td>name</td>
        				</tr>
         <%    //获取数据库中的留言信息，并通过循环方式输出留言                                                        
			int db_id2;
         	String custom_num;
         	String name;
  			  try {
      				String SQL = "SELECT * from custom_name";
      				rs = stmt.executeQuery(SQL);
      				while (rs.next()) {    
    	  			db_id2 = rs.getInt(1);
    	  			custom_num = rs.getString(2);
    	  			name = rs.getString(3);
    	 %>
        			
        				<tr>
        					<td><%=db_id2 %></td>
        					<td><%=custom_num %></td>
        					<td><%=name %></td>
        				</tr>
        			
        			
           <%   }
      				con.close();
	} catch (Exception e) {
      e.printStackTrace();
    } 
  %>
  </table>
    </div>
</body>
</html>
